package com.aipartner.service;

import com.aipartner.common.PageResult;
import com.aipartner.dto.PaymentResponse;
import com.aipartner.dto.VipInfo;
import com.aipartner.dto.VipPlanResponse;
import com.aipartner.dto.VipPurchaseRequest;
import com.aipartner.dto.VipPackageRequest;
import com.aipartner.entity.User;
import com.aipartner.entity.VipOrder;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * VIP Service Interface
 * 
 * @author AI Partner Team
 * @since 2024-01-20
 */
public interface VipService {
    
    /**
     * Get all VIP plans (for user interface)
     * 
     * @return VIP plans list (only active plans)
     */
    List<VipPlanResponse> getVipPlans();
    
    /**
     * Get all VIP packages for admin
     * 
     * @return VIP packages list (all packages for admin management)
     */
    List<VipPlanResponse> getAdminVipPackages();
    
    /**
     * Get user VIP information
     * 
     * @param userId User ID
     * @return User VIP information
     */
    VipInfo getUserVipInfo(Long userId);
    
    /**
     * Create VIP order
     * 
     * @param request VIP purchase request
     * @return Payment response
     */
    PaymentResponse createVipOrder(VipPurchaseRequest request);
    
    /**
     * Handle payment callback
     * 
     * @param orderNo Order number
     * @param transactionId Transaction ID
     * @param status Payment status
     * @return Whether processing was successful
     */
    boolean handlePaymentCallback(String orderNo, String transactionId, String status);
    
    /**
     * Get user VIP orders
     * 
     * @param userId User ID
     * @param current Current page
     * @param size Page size
     * @return User VIP orders
     */
    PageResult<VipOrder> getUserOrders(Long userId, Long current, Long size);
    
    // ==================== 管理端方法 ====================
    
    /**
     * Get admin VIP statistics
     * 
     * @return VIP statistics data
     */
    Map<String, Object> getAdminVipStats();
    
    /**
     * Get admin VIP users list
     * 
     * @param page Pagination object
     * @param keyword Search keyword
     * @param status VIP status
     * @param level VIP level
     * @return VIP users page
     */
    Page<User> getAdminVipUsers(Page<User> page, String keyword, String status, String level);
    
    /**
     * Extend VIP user subscription
     * 
     * @param userId User ID
     * @param duration Duration
     * @param durationType Duration type (day/month/year)
     * @return Whether extension was successful
     */
    boolean extendVipUser(Long userId, Integer duration, String durationType);
    
    /**
     * Cancel user VIP
     * 
     * @param userId User ID
     * @param reason Cancellation reason
     * @return Whether cancellation was successful
     */
    boolean cancelUserVip(Long userId, String reason);
    
    /**
     * Update VIP package status
     * 
     * @param packageId Package ID
     * @param status Status (1-enabled, 0-disabled)
     * @return Whether update was successful
     */
    boolean updateVipPackageStatus(Long packageId, Integer status);
    
    /**
     * Delete VIP package
     * 
     * @param packageId Package ID
     * @return Whether deletion was successful
     */
    boolean deleteVipPackage(Long packageId);
    
    /**
     * Get admin VIP orders list
     * 
     * @param page Pagination object
     * @param keyword Search keyword
     * @param status Order status
     * @return VIP orders page
     */
    Page<VipOrder> getAdminVipOrders(Page<VipOrder> page, String keyword, String status);
    
    /**
     * Refund VIP order
     * 
     * @param orderNo Order number
     * @param reason Refund reason
     * @param amount Refund amount
     * @return Whether refund was successful
     */
    boolean refundVipOrder(String orderNo, String reason, BigDecimal amount);
    
    /**
     * Create VIP package
     * 
     * @param request VIP package request
     * @return Whether creation was successful
     */
    boolean createVipPackage(VipPackageRequest request);
    
    /**
     * Update VIP package
     * 
     * @param packageId Package ID
     * @param request VIP package request
     * @return Whether update was successful
     */
    boolean updateVipPackage(Long packageId, VipPackageRequest request);
}